package com.mariusz.data.dto;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import javax.xml.bind.annotation.XmlAnyElement;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElementWrapper;
import javax.xml.bind.annotation.XmlRootElement;

import com.mariusz.data.enums.PaymentsIntervals;

public class Property implements Serializable {

	private String name;
	private String address;
	private List<Room> rooms ;
	/** Landlords details: */
	private String landlordName;
	private String landlordAdress;
	private String landlordAccountNo;
	private String landlordPhone;
	private Date contractBeginDate;
	private Date contractEndDate;
	private Double deposit;
	private Double paymentAmount;
	private PaymentsIntervals interval;
	
	private List<Payment> payments = new ArrayList<Payment>();
	
	public Property(){
		rooms = new ArrayList<Room>();
		payments= new ArrayList<Payment>();

	}
	
	public void setName(String name) {
		this.name = name;
	}
	@XmlElement
	public String getName() {
		return name;
	}
	public void setLandlordPhone(String landlordPhone) {
		this.landlordPhone = landlordPhone;
	}
	@XmlElement
	public String getLandlordPhone() {
		return landlordPhone;
	}

	public void setAddress(String address) {
		this.address = address;
	}
	@XmlElement
	public String getAddress() {
		return address;
	}
	@XmlElement
	public List<Room> getRooms() {
		return rooms;
	}
	public String toString(){
		return name;
	}
	public void setPayments(List<Payment> payments) {
		this.payments = payments;
	}
	@XmlElement(name="Payment")
	@XmlElementWrapper(name="Payments")
	public List<Payment> getPayments() {
		return payments;
	}

	@Override
	public boolean equals(Object obj) {
		if(obj instanceof Property){
			Property p = (Property)obj;
			if(getName().equals(p.getName()) && getAddress().equals(p.getAddress())){
				return true;
			}
		}
		return false;
	}

	public void setLandlordName(String landlordName) {
		this.landlordName = landlordName;
	}

	@XmlElement
	public String getLandlordName() {
		return landlordName;
	}

	public void setLandlordAdress(String landlordAdress) {
		this.landlordAdress = landlordAdress;
	}
	@XmlElement
	public String getLandlordAdress() {
		return landlordAdress;
	}

	public void setLandlordAccountNo(String landlordAccountNo) {
		this.landlordAccountNo = landlordAccountNo;
	}
	@XmlElement
	public String getLandlordAccountNo() {
		return landlordAccountNo;
	}

	public void setContractBeginDate(Date contractBeginDate) {
		this.contractBeginDate = contractBeginDate;
	}
	@XmlElement
	public Date getContractBeginDate() {
		return contractBeginDate;
	}

	public void setContractEndDate(Date contractEndDate) {
		this.contractEndDate = contractEndDate;
	}
	@XmlElement
	public Date getContractEndDate() {
		return contractEndDate;
	}

	public void setDeposit(Double deposit) {
		this.deposit = deposit;
	}

	@XmlElement
	public Double getDeposit() {
		return deposit;
	}

	public void setInterval(PaymentsIntervals interval) {
		this.interval = interval;
	}

	@XmlElement
	public PaymentsIntervals getInterval() {
		return interval;
	}

	public void setPaymentAmount(Double paymentAmount) {
		this.paymentAmount = paymentAmount;
	}
	@XmlElement
	public Double getPaymentAmount() {
		return paymentAmount;
	}
	
}
